<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2017/10/31 0031
 * Time: 10:37
 */

namespace Admin\Controller;
use Think\Controller;
class DropDownController extends CommonController {
    /* public function index(){
         $cate = M('region_list')->where(array('parent_region_id'=>1))->select();
         $this->assign('cate',$cate);
          $this->display();
     }
     //下级分类（市）
     public function subordinate(){
         $id = I('post.id');
         $list = M('region_list')->where(array('parent_region_id'=>$id))->select();
         die(json_encode(array('state'=>'200','rel'=>$list)));
     }*/

    public function test(){
        /* $db = M('region_list');
         $province = $db ->where(array('parent_region_id'=>1))->select();
         $list = '';
         foreach($province as $k=>$v){
             $rel['id'] = $v['region_id'];
             $rel['text'] = $v['region_name'];
             $rel['state'] = 'closed';
             $city = $db->field('region_id as id,region_name as text') ->where(array('parent_region_id'=> $v['region_id']))->select();
             foreach($city as $sk=>$sv){
                 $city[$sk]['state'] = 'closed';
             }

             foreach($city as $qk=>$qv){
                 $rel['children'][$qk] = $qv;

                 $area =$db->field('region_id as id,region_name as text')->where(array('parent_region_id'=> $qv['id']))->select();

                     $rel['children'][$qk]['children']=$area;



             }
             $list[] = $rel;

         }

         die(json_encode($list));*/

        $this->display();
    }

}